home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2007 December / PCWKCD1207B.iso / Blogowanie poza sfera / Flock 0.9.1.3 stable / flock-0.9.1.3.en-US.win32.exe / flock / yahootoolbar.xpi / components / nsYahooFeedNode.js < prev    next >
Text File  |  2007-01-12  |  4KB  |  118 lines

  1. /*
  2.  * Copyright 2005 - 2006 Yahoo! Inc. All rights reserved.
  3.  */
  4. function nsIYahooFeedNode(){
  5.     this.ICON_URL = "http:\/\/us.i1.yimg.com/us.yimg.com/i/tb/iconsgif/";
  6.     this.SKIN_URL = "chrome:\/\/ytoolbar/skin/";
  7.     this.BUTTON_TYPE = 0x02;
  8.     this.BUTTONMENU_TYPE = 0x04;
  9.     this.DIALOG_TYPE = 0x08;
  10.     this.EDITBOX_TYPE = 0x07;
  11.     this.MENU_TYPE = 0x03;
  12.     this.MENUITEM_TYPE = 0x16;
  13.     this.SEPARATOR_TYPE = 0x17
  14.     this.PARAM_TYPE = 0x06;
  15.     this.VALUE_TYPE = 0x09;
  16.     this.id = null;
  17.     this.name = null;
  18.     this.value = null;
  19.     this.type = 0;
  20.     this.func = null;
  21.     this.funcNum = -1;
  22.     this.funcUrl = "";
  23.     this.funcTracking = -1;
  24.     this.hash = "";
  25.     this.icon = null;
  26.     this.styles = "";
  27.     this.childSize = 0;
  28.     this.childNodes = null;
  29.     this.parentNode = null;
  30.     this.baseID = "";
  31.     this.domToolbar = null;
  32.     this.domMenubar = null;
  33.     this.mIdFull = null;
  34.     this.iconPath = null;
  35.     this.addChild = function (node){
  36.         node.parentNode = this;
  37.         if(this.childSize == 0){
  38.             this.childNodes = Components.classes["@mozilla.org/array;1"].createInstance(Components.interfaces.nsIMutableArray);
  39.         }
  40.         this.childNodes.appendElement(node, false);
  41.         this.childSize++
  42.     }
  43.     this.getChild = function(index){
  44.         return (index < this.childSize) ? this.childNodes.queryElementAt(index, Components.interfaces.nsIYahooFeedNode) : null;
  45.     }    
  46.     this.getNodeById = function(id){
  47.         if(this.id == id){
  48.             return this;
  49.         }
  50.         if(this.childSize > 0){
  51.             var node;
  52.             for(var i = 0; i < this.childSize; i++){
  53.                 if( (node = this.getChild(i).getNodeById(id)) != null){
  54.                     return node;
  55.                 }
  56.             }
  57.         }
  58.         return null;
  59.     }
  60.     this.destroy = function(){
  61.         if(this.childNodes != null){
  62.             for(var i = 0; i < this.childSize; i++){
  63.                 this.getChild(i).destroy();
  64.             }
  65.             this.childSize = 0;
  66.             this.childNodes.clear();
  67.         }
  68.         this.domMenubar = null;
  69.         this.domToolbar = null;
  70.         this.parentNode = null;
  71.         this.childNodes = null;
  72.         this.hash = null;
  73.     }
  74.     this.formatFunction = function(){
  75.     }
  76.     this.debug = function(msg){
  77.         if(typeof(Components.interfaces.nsIDebugLoggerManager) != 'undefined'){
  78.             logMngr = Components.classes["@mozmonkey.com/debuglogger/manager;1"].getService(Components.interfaces.nsIDebugLoggerManager);
  79.             logger = logMngr.registerLogger("yfeedtest");
  80.             logger.log(3, msg);
  81.         }
  82.     }
  83. }
  84. nsIYahooFeedNode.prototype = {
  85.     QueryInterface: function (iid) {
  86.         if(!iid.equals(Components.interfaces.nsIYahooFeedNode) && !iid.equals(Components.interfaces.nsISupports))
  87.             throw Components.results.NS_ERROR_NO_INTERFACE;
  88.         return this;
  89.     }
  90. };
  91. function NSGetModule(compMgr, fileSpec) {
  92.     return {
  93.         myCID         : Components.ID("{AFF842C7-8EDB-404f-9443-5DE5C96F1B25}"),
  94.         myProgID     : "@yahoo.com/feed/node;1",
  95.         firstTime    : true,
  96.         registerSelf : function (compMgr, fileSpec, location, type) {
  97.             if (this.firstTime) {
  98.                 this.firstTime = false;
  99.                 throw Components.results.NS_ERROR_FACTORY_REGISTER_AGAIN;
  100.             }
  101.             compMgr = compMgr.QueryInterface(Components.interfaces.nsIComponentRegistrar);
  102.             compMgr.registerFactoryLocation(this.myCID, "Yahoo! Feed Node", this.myProgID, fileSpec, location, type);
  103.         },
  104.         getClassObject : function (compMgr, cid, iid) {
  105.             if (!cid.equals(this.myCID)) throw Components.results.NS_ERROR_NO_INTERFACE;
  106.             if (!iid.equals(Components.interfaces.nsIFactory)) throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
  107.             return this.myFactory;
  108.         },
  109.         myFactory : {
  110.             createInstance : function (outer, iid) {
  111.                 if (outer != null) throw Components.results.NS_ERROR_NO_AGGREGATION;
  112.                 return (new nsIYahooFeedNode()).QueryInterface(iid);
  113.             }
  114.         },
  115.         canUnload : function(compMgr) { return true; }
  116.     };
  117. }
  118.